label: Don't deduce label width from logical rect
authorBenjamin Otte <otte@redhat.com>
Sat, 6 Nov 2021 02:15:04 +0000 (03:15 +0100)
committerBenjamin Otte <otte@redhat.com>
Sat, 6 Nov 2021 02:15:04 +0000 (03:15 +0100)
The width of a logical rect after line breaking is sometimes not
wide enough to cause line breaking to break at the exact same points.
(Is that by design or a bug in Pango? I don't know.)

So don't use the width, and only relyon values we actually set to
pango_layout_set_width().

gtk/gtklabel.c

index 3580deae1ed474876e068eae6136e69f1117a67a..3c3be854069d4cdbf11755dba11b4a6b63337bc2 100644 (file)
@@ -1203,7 +1203,7 @@ get_width_for_height (GtkLabel *self,
           if (text_height > height)
             min = mid + 1;
           else
-            max = text_width;
+            max = mid;
         }
 
       *minimum_width = min;